package com.atguigu.gmall.seckill.service.impl;

import com.atguigu.gmall.seckill.entity.SeckillGoods;
import com.atguigu.gmall.seckill.mapper.SeckillGoodsMapper;
import com.atguigu.gmall.seckill.service.SeckillGoodsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
* @author lfy
* @description 针对表【seckill_goods】的数据库操作Service实现
* @createDate 2022-10-25 08:59:31
*/
@Service
public class SeckillGoodsServiceImpl extends ServiceImpl<SeckillGoodsMapper, SeckillGoods>
    implements SeckillGoodsService{

    @Autowired
    SeckillGoodsMapper seckillGoodsMapper;

    @Override
    public List<SeckillGoods> getSeckillGoodsByDate(String formatDate) {

        return seckillGoodsMapper.getSeckillGoodsByDate(formatDate);
    }

    @Transactional
    @Override
    public void deduceStock(Long skuId, int i) {
        seckillGoodsMapper.updateDeduceStockCount(skuId,i);
    }
}




